package com.klasster.recruitmentPlatform.common.configurer;

import com.klasster.recruitmentPlatform.common.interceptor.TokenInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
public class WebConfigurer implements WebMvcConfigurer {


    private final TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor) //配置拦截器
                .addPathPatterns("/**") //拦截请求路径
                .excludePathPatterns("/auth/login")
                .excludePathPatterns("/auth/register")
                .excludePathPatterns("/seeker/getCommonRecommendJobs")
                .excludePathPatterns("/seeker/getCommonRecommendCompanies");
    }

}
